package com.mask.thread.pk02;

import java.util.concurrent.TimeUnit;

/**
 * wait和notify所在的线程用的是同一个lock锁
 * notify/notifyAll不立即释放锁
 * @author hx
 * @since 2021/12/2 2:05 下午
 */

public class Test {
    public static void main(String[] args) {
        try {
            Object lock = new Object();
            MyThread1 thread1 = new MyThread1(lock);
            thread1.start();

            TimeUnit.SECONDS.sleep(3);

            MyThread2 thread2 = new MyThread2(lock);
            thread2.start();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
